/****************************************************************************
 *
 * Copyright (C) 2003-2008 Los Alamos National Security, LLC
 *                         Packet Analytics Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 2 as
 * published by the Free Software Foundation.  You may not use, modify or
 * distribute this program under any other version of the GNU General
 * Public License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 ****************************************************************************/
package nfse.gui.query;

import com.google.gwt.user.client.ui.HorizontalPanel;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.MessageBox;
import com.gwtext.client.widgets.Window;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;

import nfse.gui.client.NetFSEClient;

public class SearchWindow extends Window {

    
    public SearchWindow(SearchTab search) {
        
        setTitle("New Search");
        
        this.setShadow(true);
        this.setFrame(true);
        
        this.setIconCls("pac-icon");
        
        final SearchWindow thisWindow = this;
        final SearchTab searchTab = search;
        this.add(searchTab);
        HorizontalPanel buttons = new HorizontalPanel();
        Button cancelButton = new Button();
        cancelButton.setText("Cancel");
        cancelButton.addListener(new ButtonListenerAdapter() {
            public void onClick(Button button, EventObject obj) {
                thisWindow.hide();
                
            }
        });
        
        Button okButton = new Button();
        okButton.setText("OK");
        okButton.addListener(new ButtonListenerAdapter() {
            public void onClick(Button button, EventObject obj) {
                searchTab.query();
                thisWindow.hide();
            }
        });

        Button resetButton = new Button();
        resetButton.setText("Reset");
        resetButton.addListener(new ButtonListenerAdapter() {
            public void onClick(Button button, EventObject obj) {
                searchTab.initWidgets();
            }
        });
        
        //buttons.add(resetButton);
        //buttons.add(okButton);
        //buttons.add(cancelButton);
        this.addButton(resetButton);
        this.addButton(okButton);
        this.addButton(cancelButton);
    }
}
